package main

import (
	"encoding/xml"
	"fmt"
)

type person struct {
	Name string `xml:"name"`
	Age  int    `xml:"age"`
}

func main() {
	p1 := person{"xiaobai", 6}
	var data []byte
	if data, err := xml.MarshalIndent(p1, "", " "); err != nil {
		fmt.Println("失败")
	} else {
		fmt.Println(string(data))
	}
	p2 := new(person)
	fmt.Println(p2, p2.Age)
	p3 := xml.Unmarshal(data, p2)
	if p3 != nil {
		fmt.Println(p3)
	}

	var map1 = new(map[string]string)
	fmt.Println(map1, (*map1)["name"])
}
